/****************************************
 ****************************************
 **   This document written by CTonk.  **
 **         ctonk@hotmail.com          **
 ****************************************
 ****************************************/

// world.h

#ifndef H_WORLD
#define H_WORLD

#include <list>
#include "Creature.h"
#include "Character.h"
#include "Commands.h"

Magiclist< Character* > ChList;
std::list< Command* > CmdList;


class World
{
	private:
		static World _instance;
		bool _copyover;
		bool _shutdown;
		Time::clock* _clock;
		Magiclist< Area* > _areas;
		Magiclist< std::string > _quotelist;
		std::string _version;

		void InitializeCommands();
		void InitializeQuotes();
		void UpdateCharacters();
		void HandleInput();
		void UpdateTimers();
		void Schedule();
		void FireEvent();

	public:
		World();
		~World();

		bool _exists;
		static World& Instance();

		Time::clock* GetClock();
		Magiclist< Area* >& GetAreas();
		Area* GetArea( int );
		Area* SetArea( int, Area& );
		Area* AddArea();
		void AddAreas( int );
		Character* FindCharacter( char* );
		Room* FindRoom( int );
		Command* FindCommand( char* );
		bool Broadcast( char* );
		void FlushOutput();
		bool Shutdown();
		bool Copyover();
		bool CopyoverRecovery();
		void Monitor();

		// Other methods...
		std::string& RandomQuote();
		std::string& Version();
		void Save();
		void Load();
};

inline World& World::Instance()
{
	static World _instance;
	return _instance;
}



#endif // #ifndef H_WORLD